﻿using System;

using log4net;
using System.Collections.Generic;
using System.Net;

namespace CreativeMinds.DNSAPI.Core {

	public abstract class DNSAPIBase : IDNSAPI {
		private readonly ILog log;

		protected DNSAPIBase(ILog log) {
			this.log = log;
		}

		protected ILog Log {
			get {
				return this.log;
			}
		}

		public abstract void CreatePrimaryZone(String zoneName, ZoneTransferType transfer, List<IPAddress> allowTransferTo, List<String> ns, Int32 ttl, Int32 expiryLimit, Int32 retryDelay, Int32 refreshInterval, Int32 minimumTTL, String soaStart, String responsiblePerson);
		public abstract void CreateSecondaryZone(String zoneName, List<IPAddress> primaries);
		public abstract void ReadZone();
		public abstract void UpdatePrimaryZone();
		public abstract void UpdateSecondaryZone(String zoneName, List<IPAddress> primaries);
		public abstract void DeleteZone(String zoneName);

		public abstract void CreateARecord(String zoneName, String domain, IPAddress address);
		public abstract void CreateAAAARecord(String zoneName, String domain, IPAddress address);
		public abstract void CreateCNAMERecord(String zoneName, String domain, String alias);
		public abstract void CreateMBRecord(String zoneName, String domain, String server);
		public abstract void CreateMXRecord(String zoneName, String domain, String server, Int32 priority);
		public abstract void CreateNSRecord(String zoneName, String domain, String server);
		public abstract void CreateRPRecord(String zoneName, String domain, String mailHost, String text);
		public abstract void CreateSOARecord(String zoneName, String server, String responsiblePerson, Int32 expiryLimit, Int32 minimumTTL, Int32 refreshInterval, Int32 retryDelay, Int32 serialNumber);
		public abstract void CreateTXTRecord(String zoneName, String domain, String text);

		public abstract void UpdateARecord(String zoneName, String domain, IPAddress address);
		public abstract void UpdateAAAARecord(String zoneName, String domain, IPAddress address);
		public abstract void UpdateCNAMERecord(String zoneName, String domain, String alias);
		public abstract void UpdateMBRecord(String zoneName, String domain, String mailHost);
		public abstract void UpdateSOARecord(String zoneName, String server, String responsiblePerson, Int32 expiryLimit, Int32 minimumTTL, Int32 refreshInterval, Int32 retryDelay, Int32 serialNumber);
		public abstract void UpdateMXRecord(String zoneName, String domain, String oldHost, String newHost, Int32 oldPriority, Int32 newPriority);
		public abstract void UpdateTXTRecord(String zoneName, String domain, String oldText, String newText);

		public abstract void DeleteARecord(String zoneName, String domain);
		public abstract void DeleteAAAARecord(String zoneName, String domain);
		public abstract void DeleteCNAMERecord(String zoneName, String domain);
		public abstract void DeleteNSRecord(String zoneName, String domain, String server);
		public abstract void DeleteMBRecord(String zoneName, String domain);
		public abstract void DeleteRPRecord(String zoneName, String domain, String mailHost);
		public abstract void DeleteMXRecord(String zoneName, String domain, String mailHost, Int32 priority);
		public abstract void DeleteTXTRecord(String zoneName, String domain, String text);
		public abstract void DeleteSOARecord(String zoneName);
		public abstract void DeleteAllTXTRecords(String zoneName);
		public abstract void DeleteAllMXRecords(String zoneName);
	}
}